/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("Ccd_Report",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using ATkg.BizAppProject.DomainModels;
using ATkg.BizAppProject.IServices;
using DGZImp.Core.Utilities.Response;
using Microsoft.AspNetCore.Authorization;

namespace ATkg.BizAppProject.Controllers
{
    public partial class Ccd_ReportController
    {
        private readonly ICcd_ReportService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public Ccd_ReportController(
            ICcd_ReportService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }

       
        [HttpPost("AddNew")]
        [AllowAnonymous]
        public async Task<ApiResponse<string>> AddNew([FromBody] Ccd_Report model)
        {
            await Service.AddNew(model);
            return ApiRes.Success("");
        }

        /// <summary>
        /// 检查电镀号是否存在
        /// </summary>
        /// <param name="DianduNo"></param>
        /// <returns></returns>
        /// 
        [HttpGet("CheckDianduNo")]
        [AllowAnonymous]
        public async Task<long> CheckDianduNo(string DianduNo)
        {
            return await  Service.CheckSome(DianduNo);
        }

        [HttpGet("GetProductEmailInfo")]
        [AllowAnonymous]
        public async Task<long> GetProductEmailInfo(string ProductId)
        {
            return await Service.GetProductEmailInfo(ProductId);
        }
    }
}
